package com.example.mymvvmdemo.net.model;


import com.example.mymvvmdemo.BuildConfig;
import com.example.mymvvmdemo.constants.Constants;

public class BaseModel {

    public String secversion = "1.0";
    private static String language;

    public String cliVer = BuildConfig.VERSION_NAME;

    public static String key = Constants.key;//正式环境  HMACSHA256加密Secret

    public static void setKey(String type) {

    }

    public String getRandom() {
        StringBuffer sb = new StringBuffer();
//        String strRand = "";
        for (int i = 1; i < 20; i++) {
            sb.append(String.valueOf((int) (Math.random() * 10)));
//            strRand += String.valueOf((int) (Math.random() * 10));
        }
        return sb.toString();
    }

    public static String getLanguage() {
//        language = SpUtils.getSpUtils(MyApplication.getInstance(), Constants.ACCOUNT_NAME).getStringValue(Constants.USER_LANGUAGE_HEAD, LanguageHeadEntity.CHINESE);
//        return language;
        return "zh";
    }

    public boolean isNetWorkError(String result) {
        //判断请求网络是否异常
        if (result.contains(Constants.NETWORK_ERROR) ||
                result.contains(Constants.NETWORK_ERROR2) ||
                result.contains(Constants.NETWORK_ERROR3)) {
            return true;
        }
        return false;
    }

}
